import Vue from 'vue'
import VueRouter, { RouteConfig } from 'vue-router'
import Home from '../views/Home.vue'
import Login from '../views/Login.vue'
import ArticleDetail from '../views/ArticleDetail.vue'
import UserProfile from '../views/UserProfile.vue'
import ArticleEditor from '../views/ArticleEditor.vue'

Vue.use(VueRouter)

const routes: Array<RouteConfig> = [
  {
    path: '/',
    name: 'home',
    component: Home
  },
  {
    path: '/login',
    name: 'login',
    component: Login
  },
  {
    path: '/article/:id',
    name: 'article-detail',
    component: ArticleDetail
  },
  {
    path: '/profile',
    name: 'user-profile',
    component: UserProfile
  },
  {
    path: '/editor',
    name: 'article-editor',
    component: ArticleEditor
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
